<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html{
            overflow-y: scroll;
        }
        html,body{
            margin: 0;
            padding: 0;
            width:100%;
        }
        .toast{
            width: 370px;
            height: 48px;
            line-height: 48px;
            border-radius: 0px 0px 3px 3px;
            color: #fff;
            font-size: 12px;
            z-index: 9999999;
            position: fixed;
            background: #ed8756;
            left: 50%;
            margin-left: -185px;
            text-align: center;
            display: none;
        }
        li{
            list-style: none;
        }
        .container_wrap{
            width:1160px;
            margin:0 auto;
        }
        .header_tab{
            overflow: hidden;
        }
        .header_tab ul{
            overflow: hidden;
            padding: 0;
        }
        .header_tab ul li{
            height:36px;
            width: 114px;
            text-align: center;
            line-height: 36px;
            font-family: "微软雅黑";
            font-size: 14px;
            border: 1px solid #d7d7d7;
            float: left;
            background: #f2f2f2;
            cursor: pointer;
        }
        .header_tab ul li.active{
            background: #d7d7d7;
        }
        .header_tab ul li:nth-last-child(1){
            border-left: none;
        }
        .file,.type,.data_change{
            overflow: hidden;
            padding-bottom: 26px;
            border-bottom: 2px dashed #d7d7d7;
        }
        h3{
            font-size: 18px;
            font-weight: 600;
        }
        input{
            outline: none;
        }
        .file_left{
            width:150px;
            height:150px;
            cursor: pointer;
            background: #f2f2f2;
            border-radius: 12px;
            position: relative;
            float: left;
        }
        .file_left .upload-hide{
            cursor: pointer;
            width:150px;
            height:150px;
            position: absolute;
            z-index: 1;
            opacity: 0;
        }
        .file_left img{
            position: absolute;
            top:50%;
            left:50%;
            margin-top: -33px;
            margin-left: -37px;
        }
        .file_right{
            width:954px;
            margin-left: 20px;
            border-radius: 12px;
            height:114px;
            background: #f2f2f2;
            padding: 18px;
            float: left;
        }
        .file_right .file_info{
            background: #fff;
            width:100%;
            height:100%;
        }
        .file_info .info_top{
            border-bottom: 1px solid #f2f2f2;
            height:56px;
        }
        .file_info span{
            display: inline-block;
        }
        .file_info  span{
            font-size:16px;
            line-height: 56px;
            font-family: '微软雅黑';
            overflow: hidden;
            text-overflow:ellipsis;
            white-space: nowrap;
        }
        .file_info .info_bottom span{
            font-size: 12px;
        }
        .file_info .info_bottom  span{
            color:#9a9a9a;
        }
        .file_info span.span1{
            margin-left:24px;
            width:400px;
        }
        .file_info span.span2{
            width:400px;
        }
        .file_info span.span3{
            width:120px;
        }
         .type_container,.data_change_container,.data_count_container,.data_count_container3{
            background: #f2f2f2;
            border-radius: 12px;
            padding: 18px;
        }
        .form{
            min-height: 20px;
            margin-bottom: 14px;
        }
        /*.type_container,.data_change_container,.data_count_container .form{*/
            /*background: #fff;*/
            /*min-height: 20px;*/
        /*}*/
         .form p{
            height:50px;
            line-height: 50px;
            padding-bottom: 4px;
             margin:0;
             background: #fff;
            border-bottom: 1px solid #f2f2f2;
        }
         .form .p_wrap p .table-text{
             margin-left: 5px;
         }
         .form p .table-name{
            padding-left:10px;
            display: inline-block;
            width:50px;
            font-size: 14px;
            font-family: '微软雅黑';
        }
       .form p .table-text{
            display: inline-block;
            width:996px;
        }
       .form p .table-text input{
            height:36px;
            width:980px;
            padding-left: 16px;
            border: 1px solid #f2f2f2;
            color: #aeaeae;
        }
        .form p .table-text input.two_width{
            width:580px;
        }
        .form p .table-text input.three_width{
            width:180px;
        }
        .form p .table-text input.four_width{
            width:180px;
        }
        .form p .table-text input.check{
            width: 14px;
            height:14px;
            margin-left: 50px;
        }

        /*.form p .table-text.row2 input{*/
            /*height:36px;*/
            /*width:980px;*/
            /*padding-left: 16px;*/
            /*border: 1px solid #d7d7d7;*/
            /*color: #aeaeae;*/
        /*}*/
        /*.form p .table-text.row3 input{*/
            /*height:36px;*/
            /*width:980px;*/
            /*padding-left: 16px;*/
            /*border: 1px solid #d7d7d7;*/
            /*color: #aeaeae;*/
        /*}*/
        .form p span.txt{
            font-size: 14px;
            font-family: '微软雅黑';
        }
        .form p select{
            outline: none;
            width:180px;
            height:39.5px;
            border: 1px solid #f2f2f2;
            color:#aeaeae;
            position: relative;
            z-index:2
        }
        label{
            position: absolute;
            left: 7px;
            top: -12px;
            z-index: 1;
            font-size: 14px;
            color: #ccc;
        }
         .form p .table-clear{
            display: inline-block;
            width: 48px;
            height:50px;
            text-align: center;
             z-index: 999;
        }
         .table-clear img{
             vertical-align: middle;
         }
         .button{
            display: inline-block;
            cursor: pointer;
            width: 140px;
            height:40px;
            line-height: 40px;
            border-radius: 4px;
            font-size: 14px;
            background: #6b6b6b;
            color: #fff;
            text-align: center;
        }
        .btn .describe{
            color: #aeaeae;
            font-size: 12px;
        }
        .btn .describe input{
            vertical-align: middle;
        }
        .btn2{
            text-align: center;
            margin: 22px 0 40px 0;
        }
        .form p.margin_bottom{
            margin-bottom: 20px;
        }
        .select_margin{
            margin:0 10px;
        }
        .li_two .data_count_container .form p input,select{
            margin-right: 10px;
        }
        .li_two .data_count_container3 .form p input,select{
            margin-right: 10px;
        }
        .li_one input{
            margin-right: 10px;
        }
        .select_wrap{
            position: relative;
        }
        #loaders{
            display: none;
        }
        .loaders {
            width: 128px;
            position: absolute;
            left: 50%;
            top: 50%;
            margin-top: -100px;
            margin-left: -64px;
            z-index: 200;
        }
        .modal-backdrop{
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background-color: #000000;
            opacity: 0.5;
            z-index: 100;
            filter: alpha(opacity=50);
        }
        main .loaders .loader {
            box-sizing: border-box;
            display: flex;
            margin:auto auto;
            flex: 0 1 auto;
            flex-direction: column;
            flex-grow: 1;
            flex-shrink: 0;
            flex-basis: 25%;
            max-width: 25%;
            height: 200px;
            align-items: center;
            justify-content: center; }


        /**
         * Lines
         */
        @-webkit-keyframes line-scale {
            0% {
                -webkit-transform: scaley(1);
                transform: scaley(1); }

            50% {
                -webkit-transform: scaley(0.4);
                transform: scaley(0.4); }

            100% {
                -webkit-transform: scaley(1);
                transform: scaley(1); } }
        @keyframes line-scale {
            0% {
                -webkit-transform: scaley(1);
                transform: scaley(1); }

            50% {
                -webkit-transform: scaley(0.4);
                transform: scaley(0.4); }

            100% {
                -webkit-transform: scaley(1);
                transform: scaley(1); } }

        .line-scale > div:nth-child(1) {
            -webkit-animation: line-scale 0.6s 0.1s infinite cubic-bezier(.2, .68, .18, 1.08);
            animation: line-scale 0.6s 0.1s infinite cubic-bezier(.2, .68, .18, 1.08); }
        .line-scale > div:nth-child(2) {
            -webkit-animation: line-scale 0.6s 0.2s infinite cubic-bezier(.2, .68, .18, 1.08);
            animation: line-scale 0.6s 0.2s infinite cubic-bezier(.2, .68, .18, 1.08); }
        .line-scale > div:nth-child(3) {
            -webkit-animation: line-scale 0.6s 0.3s infinite cubic-bezier(.2, .68, .18, 1.08);
            animation: line-scale 0.6s 0.3s infinite cubic-bezier(.2, .68, .18, 1.08); }
        .line-scale > div:nth-child(4) {
            -webkit-animation: line-scale 0.6s 0.4s infinite cubic-bezier(.2, .68, .18, 1.08);
            animation: line-scale 0.6s 0.4s infinite cubic-bezier(.2, .68, .18, 1.08); }
        .line-scale > div:nth-child(5) {
            -webkit-animation: line-scale 0.6s 0.5s infinite cubic-bezier(.2, .68, .18, 1.08);
            animation: line-scale 0.6s 0.5s infinite cubic-bezier(.2, .68, .18, 1.08); }
        .line-scale > div {
            background-color: #88b14b;
            width: 4px;
            height: 35px;
            border-radius: 2px;
            margin: 2px;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
            display: inline-block; }

        @-webkit-keyframes line-scale-party {
            0% {
                -webkit-transform: scale(1);
                transform: scale(1); }

            50% {
                -webkit-transform: scale(0.5);
                transform: scale(0.5); }

            100% {
                -webkit-transform: scale(1);
                transform: scale(1); } }
    </style>
</head>
<body>
<div  id="loaders">
    <div class="modal-backdrop"></div>
    <div class="loaders">
        <!--<div class="loader-inner line-scale">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>-->
        <img src="img/load.jpg"/>
    </div>
</div>
    <div class="container_wrap">
        <div class="container">
            <div class="toast"></div>
            <div class="header_tab">
                <ul>
                    <li class="active">程序1</li>
                    <li >程序2</li>
                </ul>
            </div>
            <div class="li_one">
                <div class="file">
                    <h3>文件选择</h3>
                    <div class="file_left">
                        <input class="upload-hide" id="upload-hide1" name="upload-hide1" type="file" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                        <img src="img/fileupload.png">
                    </div>
                    <div class="file_right">
                        <div class="file_info">
                            <div class="info_top">
                                <span class="span1">文件名</span>
                                <span class="span3">文件大小</span>
                            </div>
                            <div class="info_bottom">
                                <span class="span1"></span>
                                <span class="span3"></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="data_count">
                    <h3>数据计算</h3>
                    <div class="data_count_container data_count_container1">
                        <div class="form form1">
                            <form action="">
                                <p class="margin_bottom">
                                    <span class="table-name">去重列</span>
                                    <span class="table-text row3">
                                            <input type="text" id="delChongLie" class="three_width" placeholder="请输入表格的列">
                                        </span>
                                </p>
                                <div class="p_wrap">

                                </div>
                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加列</span>
                            <span class="describe"></span>
                        </div>
                    </div>
                </div>
                <div class="data_count">
                    <h3>数据二次计算</h3>
                    <div class="data_count_container data_count_container2">
                        <div class="form form2">
                            <form action="">
                                <div class="p_wrap">

                                </div>
                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加列</span>
                            <span class="describe"></span>
                        </div>
                    </div>
                </div>
                <div class="btn2">
                    <span class="button"  id="createTable">生成表格</span>
                </div>
        </div>
            <div class="li_two" style="display: none">
                <div class="file">
                    <h3>文件选择</h3>
                    <div class="file_left">
                        <input class="upload-hide" id="upload-hide2" name="upload-hide2" type="file" accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
                        <img src="img/fileupload.png">
                    </div>
                    <div class="file_right">
                        <div class="file_info">
                            <div class="info_top">
                                <span class="span1">文件名</span>
                                <span class="span3">文件大小</span>
                            </div>
                            <div class="info_bottom">
                                <span class="span1">文件名</span>
                                <span class="span3">文件大小</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="type">
                    <h3>类目</h3>
                    <div class="type_container">
                        <div class="form form1">
                            <form action="">
                                <p class="margin_bottom">
                                    <span class="table-name">分类项</span>
                                    <span class="table-text row3">
                                            <input type="text" id="del2ChongLie" class="three_width" onkeyup="value=value.replace(/[^a-zA-Z]/g,'')" placeholder="请输入专业领域对应的列">
                                    </span>
                                </p>
                                <div class="p_wrap">

                                </div>
                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加类目</span>
                            <span class="describe">请输出类目为列1</span>
                        </div>
                    </div>

                </div>
                <div class="data_change">
                    <h3>数据筛选</h3>
                    <div class="data_change_container">
                        <div class="form form2">
                            <form action="">
                                <div class="p_wrap">

                                </div>
                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加数据筛选条件</span>
                            <span class="describe">请输出类目为列1</span>
                        </div>
                    </div>
                </div>
                <div class="data_count">
                    <h3>数据计算</h3>
                    <div class="data_count_container">
                        <div class="form">
                            <form action="">

                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加列</span>
                            <span class="describe">
                                <input type="checkbox" checked>输出所有顶部算法的值与权重的和
                            </span>
                        </div>
                    </div>
                </div>
                <div class="data_Secondcount">
                    <h3>数据二次计算</h3>
                    <div class="data_count_container3">
                        <div class="form form2">
                            <form action="">
                                <div class="p_wrap">

                                </div>
                            </form>
                        </div>
                        <div class="btn">
                            <span class="button">添加列</span>
                            <span class="describe"></span>
                        </div>
                    </div>
                </div>
                <div class="btn2">
                    <span class="button">生成表格</span>
                </div>
            </div>

        </div>
    </div>
   <script src="jquery-3.1.0.min.js"></script>
    <script src="ajaxfileupload.js"></script>
<script>
    $(function () {
        $('.header_tab ul li').click(function (e) {
            $('.header_tab ul li').removeClass('active');
            $(e.target).addClass('active');
            var index = $(this).index()+1;
            console.log($('.li_one').css('display'));
            if($('.li_one').css('display')=='block'){
                $('.li_two .upload-hide').val('');
                $('.li_two .info_bottom .span1').html('');
                $('.li_two .info_bottom .span3').html('');
            }else{
                $('.li_one .upload-hide').val('');
                $('.li_one .info_bottom .span1').html('');
                $('.li_one .info_bottom .span3').html('');
            }
            if(index==1){
                $('.li_two').css('display','none');
                $('.li_one').css('display','block')
            }else{
                $('.li_one').css('display','none');
                $('.li_two').css('display','block')
            }
        });
        $(document).on("change", "#upload-hide1",function(event){
            $('#loaders').show()
            $.ajaxFileUpload({
                url: 'program1.php',
                type: 'post',
                secureuri: false, //一般设置为false
                fileElementId: 'upload-hide1', // 上传文件的id、name属性名
                dataType: 'json', //返回值类型，一般设置为json、application/json
                success: function(data, status){
					if(data.code % 100 === 0){
						$(' .info_bottom .span1').html(event.currentTarget.files[0].name);
						if(event.currentTarget.files[0].size<=1024*1024){ 
							$(' .info_bottom .span3').html((event.currentTarget.files[0].size/1024).toFixed(2)+'KB'); 
						}else{
							var filesize =event.currentTarget.files[0].size/(1024*1024);
							$(' .info_bottom .span3').html(filesize.toFixed(2)+'MB');
						}
                        $('#loaders').hide()
						prompt('上传成功');
					}else{
                        $('#loaders').hide()
						prompt('[' + data.code + '] ' + data.msg);

					}
                },
                error: function(data, status, e){
                    prompt('上传失败');
                    $('#loaders').hide();

                }
				
			
            });
			var string;
				string= '<input class="upload-hide" id="upload-hide1"'
				+ 'name="upload-hide1" type="file"'
				+'>'
				+'<img src="img/fileupload.png">';
					//$(".li_one .file_left").eq(0).html("");
					$(".li_one .file_left").eq(0).html(string);

        });
        $(document).on("change", "#upload-hide2",function(event){
            $('#loaders').show()
             $.ajaxFileUpload({
                url: 'program4.php',
                type: 'post',
                secureuri: false, //一般设置为false
                fileElementId: 'upload-hide2', // 上传文件的id、name属性名
                dataType: 'json', //返回值类型，一般设置为json、application/json
                success: function(data, status){
                    if(data.code % 100 === 0) {
                        $(' .info_bottom .span1').html(event.currentTarget.files[0].name);
                        if (event.currentTarget.files[0].size <= 1024 * 1024) {
                            $(' .info_bottom .span3').html((event.currentTarget.files[0].size / 1024).toFixed(2) + 'KB');
                        } else {
                            var filesize = event.currentTarget.files[0].size / (1024 * 1024);
                            $(' .info_bottom .span3').html(filesize.toFixed(2) + 'MB');
                        }
                        $('#loaders').hide()
                        prompt('上传成功');
                    }else{
                        $('#loaders').hide()
                        prompt('[' + data.code + '] ' + data.msg);
                    }
                }, 	
                error: function(data, status, e){
                    $('#loaders').hide()
                    prompt('上传失败');
                }
            });
           var string;
				string= '<input class="upload-hide" id="upload-hide2"'
				+ 'name="upload-hide2" type="file"><img src="img/fileupload.png">';
           // $(".li_two .file_left").eq(0).html("");
            $(".li_two .file_left").eq(0).html(string);
        });
        //程序1----数据计算
        var data1AccountArr = [{column:'',compute_type:'',date_column:''},{column:'',compute_type:'',date_column:''},{column:'',compute_type:'',date_column:''}];
        var data1AccountManage = function () {
            var html = "";
            $.each(data1AccountArr,function(i,o){
                html +=  "<p data=\""+i+"\">"
                        +"<span class=\"table-name\">列"+parseInt(1+i)+"</span>"
                        +"<span class=\"table-text row3\">"
                        +"<input type=\"text\" class=\"three_width temp\"  value=\""+o.column+"\"  data=\""+i+"\" placeholder=\"请输入表格的列\">"
                        +"<select name=\"\" data=\""+i+"\">"
                        +"<option value=\"\">请选择计算方式</option>"
                        +"<option value=\"raw\">保持原值</option>"
                        +"<option value=\"avg\">平均数</option>"
                        +"<option value=\"sum\">求和</option>"
                        +"<option value=\"first\">第一天的值</option>"
                        +"<option value=\"last\">最后一天的值</option>"
                        +" <option value=\"last-first\">最后一天的值-第一天的值</option>"
                        +"<option value=\"max\">最大值</option>"
                        +"<option value=\"min\">最小值</option>"
                        +"<option value=\"max-min\">最大值-最小值</option>"
                        +"</select>"
                        +"<input type=\"text\" style=\"display:none\" class=\"three_width hiddenrow\"  value=\""+o.date_column+"\"  data=\""+i+"\" placeholder=\"请输入日期的列\">"
                        +"</span>"
                        +"<i class=\"table-clear\">"
                        +"<img src=\" img/del.png\"  data=\""+i+"\">"
                        +"</i>"
                        +"</p>"
            });
            $(".li_one .form1 .p_wrap").html(html);
            $.each(data1AccountArr,function(i,o){
                if(o.compute_type){
                    $.each( $(".li_one .form1 .p_wrap").find('select')[i],function(){
                        if($(this).attr('value')==o.compute_type){
                            $(this).prop('selected',true)
                        }
                    })
                    //$(".li_one .form .p_wrap").find('select')[i][o.compute_type].selected=true;
                }
               if(o.date_column||o.compute_type=='first'||o.compute_type=='last'||o.compute_type=='last-first'){
                    $(".li_one .form1 .p_wrap").find('.hiddenrow').eq(i).css('display','inline-block');
                }
            })
        };
       data1AccountManage();
        $(document).on("click",".li_one .form1 i img",function (e) {
            if(data1AccountArr.length>=2){
                var indexxx = $(e.target).attr('data');
                data1AccountArr.splice(indexxx,1);
                data1AccountManage();
            }
        });
        $('.li_one .data_count_container1 .btn .button').click(function (e) {
            $(e.target).attr('src','img/del.png');
            data1AccountArr.push({column:'',compute_type:''});
            data1AccountManage();

        });
        $(document).on("blur",".li_one .form1 p input.temp",function (e) {
            var ss8 = $(e.target).attr('data');
            data1AccountArr[ss8].column = $(this).val();
        });
        $(document).on("blur",".li_one .form1 p input.hiddenrow",function (e) {
            var sss = $(e.target).attr('data');
            data1AccountArr[sss].date_column = $(this).val();
        });

        $(document).on("change",".li_one .form1 p  select",function (e) {
            var ss9 = $(e.target).attr('data');
            data1AccountArr[ss9].compute_type = $(this).val();
            if($(this).val()=='first'||$(this).val()=='last'||$(this).val()=='last-first'){
                $(e.target).parent().find('.hiddenrow').show()
                $(e.target).parent().find('.hiddenrow').val('')
            }else{
                $(e.target).parent().find('.hiddenrow').hide()
            }
        });

        //数据二次计算
        var data1AccountArr2 = [{column_a:'',compute_type:'Division',column_b:''}];
        var data1AccountManage2 = function () {
            var html2 = "";
            $.each(data1AccountArr2,function(i,o){
                html2 +=  "<p data=\""+i+"\">"
                    +"<span class=\"table-name\">列"+parseInt(1+i)+"</span>"
                    +"<span class=\"table-text row3\">"
                    +"<input type=\"text\" class=\"three_width temp1\"  value=\""+o.column_a+"\"  data=\""+i+"\" placeholder=\" 请输入数据计算的列\">"
                    +"<select name=\"\" data=\""+i+"\">"
                    +"<option value=\"Division\" selected>除以</option>"
                    +"</select>"
                    +"<input type=\"text\" class=\"three_width temp2\"  value=\""+o.column_b+"\"  data=\""+i+"\" placeholder=\" 请输入数据计算的列\">"
                    +"</span>"
                    +"<i class=\"table-clear\">"
                    +"<img src=\" img/del.png\"  data=\""+i+"\">"
                    +"</i>"
                    +"</p>"
            });
            $(".li_one .form2 .p_wrap").html(html2);
        };
        data1AccountManage2();
        $(document).on("click",".li_one .form2 i img",function (e) {
            if(data1AccountArr2.length>=1){
                var indexxx = $(e.target).attr('data');
                data1AccountArr2.splice(indexxx,1);
                data1AccountManage2();
            }
        });
        $('.li_one  .data_count_container2  .btn .button').click(function (e) {
            $(e.target).attr('src','img/del.png');
            data1AccountArr2.push({column_a:'',compute_type:'Division',column_b:''});
            data1AccountManage2();

        });
        $(document).on("blur",".li_one .form2 p input.temp1",function (e) {
            var ss8 = $(e.target).attr('data');
            data1AccountArr2[ss8].column_a = $(this).val();
        });
        $(document).on("blur",".li_one .form2 p input.temp2",function (e) {
            var sss = $(e.target).attr('data');
            data1AccountArr2[sss].column_b = $(this).val();
        });

        //程序2----类目
        var typeArr = ['','','','','','',''];
        var typeManage = function () {
            var html = "";
            $.each(typeArr,function(i,o){
                html += "<p>"
                        +"<span class=\"table-name\">类目"+parseInt(1+i)+"</span>"
                        +"<span class=\"table-text\">"
                        +"<input type=\"text\" data=\""+i+"\" name=\"title\" value=\""+o+"\" placeholder=\"请输入专业领域，多个领域以，隔开\" required>"
                        +"</span>"
                        +"<i class=\"table-clear\" >"
                       +"<img src=\"img/del.png\" data=\""+i+"\">"
                        +"</i>"
                        +"</p>"
            });
            $(".type_container .form form .p_wrap").html(html);
        };
        typeManage();
        $(document).on("click",".type_container .form i img",function (e) {
          
                var indexx = $(e.target).attr('data');
                typeArr.splice(indexx,1);
                typeManage();
           
        });
        $('.li_two .type_container .btn .button').click(function () {
            typeArr.push('');
            typeManage();
        });

        $(document).on("blur",".type_container .form form .p_wrap p input",function (e) {
            var ss = $(e.target).attr('data');
            typeArr[ss] = $(this).val()
            console.log(typeArr);
        });
        //程序2---数据筛选
        var data2ChangeArr = [{column:'',operator:'',value:''},{column:'',operator:'',value:''},{column:'',operator:'',value:''}]
        var data2ChangeManage = function () {
            var html = "";
            $.each(data2ChangeArr,function(i,o){
                html += "<p>"
                        +"<span class=\"table-name\">条件"+parseInt(1+i)+"</span>"
                        +"<span class=\"table-text row3\">"
                        +"<input type=\"text\" class=\"three_width\" data=\""+i+"\" value=\""+o.column+"\" onkeyup=\"value=value.replace(/[^a-zA-Z]/g,'')\" placeholder=\"请输入表格的列\">"
                        +"<select name=\"\" class=\"select_margin\"  data=\""+i+"\" value=\""+o.operator+"\">"
                        +"<option class=\"xuanzhon\" value=\"\">点击选择计算方式</option>"
                        +"<option class=\"xuanzhon\" value=\">\">大于</option>"
                        +"<option class=\"xuanzhon\" value=\">=\">大于等于</option>"
                        +"<option class=\"xuanzhon\" value=\"<\">小于</option>"
                        +"<option class=\"xuanzhon\" value=\"<=\">小于等于</option>"
                        +"<option class=\"xuanzhon\" value=\"=\">等于</option>"
                        +"<option class=\"xuanzhon\" value=\"top\">top</option>"
                        +"</select>"
                        +"<input type=\"text\" class=\"two_width\" data=\""+i+"\" value=\""+o.value+"\" onkeyup=\"value=value.replace(/[^0-9.-]/g,'')\" placeholder=\"请输入数值\">"
                        +"</span>"
                        +"<i class=\"table-clear\">"
                        +"<img src=\"img/del.png\" data=\""+i+"\">"
                        +"</i>"
                        +"</p>";

            });
            $(".data_change_container .form form").html(html);
            $.each(data2ChangeArr,function(i,o){
                if(o.operator){
                    $.each( $(".data_change_container .form form").find('select')[i],function(){
                        if($(this).attr('value')==o.operator){
                            $(this).prop('selected',true)
                        }
                    })
                    //$(".li_one .form .p_wrap").find('select')[i][o.compute_type].selected=true;
                }
            })
        };
        data2ChangeManage();
        $(document).on("click",".li_two .data_change_container .form form i img",function (e) {
            if(data2ChangeArr.length>=2){
                var indexy = $(e.target).attr('data');
                data2ChangeArr.splice(indexy,1);
                data2ChangeManage();
            }

        });
        $('.li_two .data_change_container .btn .button').click(function () {
            data2ChangeArr.push({column:'',operator:'',value:''});
            data2ChangeManage();
        });
        $(document).on("blur",".li_two  .data_change_container   input.three_width",function (e) {
            var ss1 = $(e.target).attr('data');
            data2ChangeArr[ss1].column = $(this).val();
        });
        $(document).on("change",".li_two  .data_change_container   select",function (e) {
            var ss2 = $(e.target).attr('data');
            data2ChangeArr[ss2].operator = $(this).val();
        });
        $(document).on("blur",".li_two  .data_change_container   input.two_width",function (e) {
            var ss3 = $(e.target).attr('data');
            data2ChangeArr[ss3].value = $(this).val();
            console.log(data2ChangeArr);
        });

        //程序2---数据计算
        var data2AccountArr = [{column:'',alogrithmic:'',weight:'',isOutRawColumn:true},{column:'',alogrithmic:'',weight:'',isOutRawColumn:true},{column:'',alogrithmic:'',weight:'',isOutRawColumn:true}]
        var data2AccountManage = function () {
            var html = "";
            $.each(data2AccountArr,function(i,o){
                html += "<p>"
                        +"<span class=\"table-name\">项"+parseInt(1+i)+"</span>"
                        +"<span class=\"table-text row3\">"
                        +"<select name=\"\"  data=\""+i+"\">"
                        +"<option value=\"\">点击选择计算方式</option>"
                        +"<option value=\"top\">顶部算法</option>"
                        +"<option value=\"raw\">保持原值</option>"
                        +"<option value=\"sum\">相加</option>"
                        +"</select>"
                        +"<input type=\"text\" class=\"three_width hhh\" data=\""+i+"\" value=\""+o.column+"\"  placeholder=\"请输入表格的列\">"
                        +"<input type=\"text\" class=\"four_width\" data=\""+i+"\" value=\""+o.weight+"\" onkeyup=\"value=value.replace(/[^0-9.-]/g,'')\" placeholder=\"请输入权重\">%"
                        +"<input type=\"checkbox\" data=\""+i+"\" class=\"check\"><span class=\"txt\">输出原始数据</span>"
                        +"</span>"
                        +"<i class=\"table-clear\">"
                        +"<img src=\"img/del.png\"data=\""+i+"\">"
                        +"</i>"
                        +"</p>"
            });
            $(".li_two .data_count_container .form form").html(html);
            $.each(data2AccountArr,function(i,o){
                if(o.alogrithmic){
                    $.each( $(".li_two .data_count_container .form form").find('select')[i],function(){
                        if($(this).attr('value')==o.alogrithmic){
                            $(this).prop('selected',true)
                        }
                    })
                    if(o.alogrithmic=="sum"){
                        $('.li_two .data_count_container p').eq(i).children('.table-text').children('.three_width').attr('placeholder',' 请输入表格的列，多个以","隔开')
                    }else{
                        $('.li_two .data_count_container p').eq(i).children('.table-text').children('.three_width').attr('placeholder',' 请输入表格的列')
                    }

                }
            })
        };
        data2AccountManage();
        $(document).on("click",".li_two .data_count_container i img",function (e) {
            if(data2AccountArr.length>=2){
                var indexz = $(e.target).attr('data');
                data2AccountArr.splice(indexz,1);
                data2AccountManage();
            }
        });
        $(document).on("blur",".li_two .data_count_container .three_width",function(e){
            var ss5 = $(e.target).attr('data');
            data2AccountArr[ss5].column = $(this).val();
        });
        $(document).on("blur",".li_two .data_count_container .four_width",function(e){
            var ss5 = $(e.target).attr('data');
            data2AccountArr[ss5].weight = $(this).val();
        });

        $(document).on("click",".li_two .data_count_container input[type='checkbox']",function(e){
            var ss5 = $(e.target).attr('data');
            data2AccountArr[ss5].isOutRawColumn = ($(this).prop('checked')?true:false);
            console.log(data2AccountArr)
        });
        $('.li_two .data_count_container .btn .button').click(function () {
            console.log(123)
            data2AccountArr.push({column:'',alogrithmic:'',weight:'',isOutRawColumn:true});
            data2AccountManage();
        });
        $(document).on("change",".li_two  .data_count_container select",function (e) {
            var ss5 = $(e.target).attr('data');
            data2AccountArr[ss5].alogrithmic = $(this).val();
            if(data2AccountArr[ss5].alogrithmic=="sum"){
                $(this).next().attr('placeholder',' 请输入表格的列，多个以","隔开')
            }else{
                $(this).next().attr('placeholder','请输入表格的列')

            }
            console.log(data2AccountArr)
        });

        //程序2---数据计算
        var data3AccountArr = [{compute_type:'addition',addend_column:''}]
        var data3AccountManage = function () {
            var html = "";
            $.each(data3AccountArr,function(i,o){
                html += "<p>"
                    +"<span class=\"table-name\">项"+parseInt(1+i)+"</span>"
                    +"<span class=\"table-text row3\">"
                    +"<select name=\"\"  data=\""+i+"\" placeholder=' 请选择计算方式'>"
                    +"<option value=\"addition\">相加</option>"
                    +"</select>"
                    +"<input type=\"text\" class=\"three_width\" data=\""+i+"\" value=\""+o.addend_column+"\"  placeholder=\" 请输入数据计算项的所有计算的序号，以'\,'隔开\" style='width:500px;'>"
                    +"</span>"
                    +"<i class=\"table-clear\">"
                    +"<img src=\"img/del.png\"data=\""+i+"\">"
                    +"</i>"
                    +"</p>"
            });
            $(".li_two .data_count_container3 .form form").html(html);
        };
        data3AccountManage();
        $(document).on("click",".li_two .data_count_container3 i img",function (e) {
            if(data3AccountArr.length>=1){
                var indexz = $(e.target).attr('data');
                data3AccountArr.splice(indexz,1);
                data3AccountManage();
            }
        });
        $(document).on("blur",".li_two .data_count_container3 .three_width",function(e){
            var ss5 = $(e.target).attr('data');
            data3AccountArr[ss5].addend_column = $(this).val();
        });
        $('.li_two .data_count_container3 .btn .button').click(function () {
            data3AccountArr.push({compute_type:'addition',addend_column:''});
            data3AccountManage();
        });
        var ajaxing = false;
        $('.btn2 .button').click(function () {
            var flagrow = true;
            ajaxing = true;
            $.each($('.li_one p input.hiddenrow'),function (i,o) {
                if($(this).css('display')=='inline-block'&&!o.value){
                    flagrow = false
                }
            });
            if($('.li_one').css('display')=='block'){
                if($('.margin_bottom input').val()==''){
                    prompt('请输入去重列');
                    ajaxing = false
                }else if(!cyclic($('.li_one .data_count_container .temp'))){
                    prompt('请输入表格的列');
                    ajaxing = false
                }else if(!cyclic($('.li_one .data_count_container select'))){
                    prompt('请选择计算方式');
                    ajaxing = false
                }else if(!flagrow){
                    prompt('请输入日期的列');
                    ajaxing = false
                }else{
                    var data={};
                    data.distnct=$('#delChongLie').val();
                    data.outColumns=data1AccountArr;
                    data.secondComputeParams=data1AccountArr2;
                    $('#loaders').show()
                    $.ajax({
                        type: 'post',
                        url: 'program2.php',
                        dataType:"json",
                        data: {"distnct":data.distnct,"outColumns":JSON.stringify(data.outColumns),"secondComputeParams":JSON.stringify(data.secondComputeParams)},
                        success: function (data) { //返回json结果
							if(data.code % 100 == 0){
								window.location.href = encodeURI(data.url);
                                $('#loaders').hide()
								prompt("生成表格成功");
							}else{
                                $('#loaders').hide()
								prompt('[' + data.code + '] ' + data.msg);
							}
                        }
                        ,
                        error: function(data, status, e){
                            $('#loaders').hide()
                            prompt('生成表格失败');
                        }
                    });
                }
            }else{
                if(!$('#del2ChongLie').val()){
                prompt('请输入专业领域对应的列');
               }else if(!cyclic($('.li_two .type_container .form2 input'))){
                    prompt('请输入类目');
                    ajaxing = false
                }else if(!cyclic($('.li_two .data_change_container input'))||!cyclic($('.li_two .data_change_container select'))){
                    prompt('请输入数据筛选内容');
                    ajaxing = false
                }else if(!cyclic($('.li_two .data_count_container input'))||!cyclic($('.li_two .data_count_container select'))){
                    prompt('请输入数据计算内容');
                    ajaxing = false
                }else{
                    var data2={};
                    data2.categoryFrom=typeArr;
                    data2.conditionFrom=data2ChangeArr;
                    data2.computeFrom=data2AccountArr;
                    data2.secondComputeParams=data3AccountArr;
                    $('#loaders').show()
                    $.ajax({
                        type: 'post',
                        url: 'program3.php',
                        dataType:"json",
                        data: {"categoryColumn":$('#del2ChongLie').val(),"categoryFrom":JSON.stringify(data2.categoryFrom),"conditionFrom":JSON.stringify(data2.conditionFrom),"computeFrom":JSON.stringify(data2.computeFrom),"isOutSumColumn":$('.describe input[type="checkbox"]').eq(0).prop("checked")?true:false,"secondComputeParams":JSON.stringify(data2.secondComputeParams)},
                        success: function (data) { //返回json结果
						    window.location.href = encodeURI(data.url);
                            $('#loaders').hide()
                            prompt("生成表格成功");
                        }
                        ,
                        error: function(data, status, e){
                            $('#loaders').hide()
                            prompt('生成表格失败');
                        }
                    });
                }
            }

        });
        var prompt = function (tip) {
            $('.toast').html(tip);
            $('.toast').stop().show();
            setTimeout(function () {
                $('.toast').stop().hide();
            },2000)
        };
        var cyclic = function (node) {
            var flag = true;
            $.each(node,function (i,o) {
                if(!o.value) {
                    flag = false
                }
            });
            if(flag){
                return true
            }else{
                return false
            }
        };
//        var delicon = function (arr) {
//            if(arr.length==2){
//               return true;
//            }else{
//                return false
//            }
//        }
    })
</script>
</body>
</html>